package com.netease.commenta;

import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;

import com.netease.commenta.common.Constants;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

public class StartActivity extends AppCompatActivity implements View.OnClickListener {

    private IWXAPI wxApi;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_start);
        findViewById(R.id.buttonWxLogin).setOnClickListener(this);
        findViewById(R.id.buttonTour).setOnClickListener(this);
        wxApi = WXAPIFactory.createWXAPI(this, Constants.WX_APP_ID, true);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id) {
            case R.id.buttonWxLogin:
                final SendAuth.Req req = new SendAuth.Req();
                req.scope = "snsapi_userinfo";
                wxApi.sendReq(req);
                break;

            case R.id.buttonTour:
                Intent intent = new Intent(this, MainActivity.class);
                startActivity(intent);
                //overridePendingTransition(R.anim.round, R.anim.round);
                finish();
                break;
        }
    }
}
